# -*- coding: utf-8 -*-
# @Time    : 2024/7/15 15:20
# @Author  : floraachy
# @File    : repo_new_milestone_page
# @Software: PyCharm
# @Desc:

# 标准库导入
# 第三方库导入
import allure
# 本地应用/模块导入
from utils.base_utils.base_page import BasePage


class RepoMilestoneDetailPage(BasePage):
    """里程碑详情页面"""
    # 【编辑里程碑】按钮
    locator_edit_milestone_button = "//a[text()='编辑里程碑']"
    # 里程碑名称
    locator_milestone_name_p = "//div[contains(@class, 'milepostDetail')]//p[contains(@class, 'font-17')]"
    # 里程碑截止日期
    locator_milestone_deadline_span = "//div[contains(@class, 'milepostDetail')]//span[contains(@class, 'color-grey-89')]"
    # 里程碑描述
    locator_milestone_desc_div = "//div[contains(@class, 'milepostDetail')]//div[contains(@class, 'color-grey-89')]"
    # 【创建疑修】按钮
    locator_new_issue_btn = "//a[text()='+ 创建疑修']"

    @allure.step("访问里程碑详情页：/{repo_owner}/{repo_identifier}/milestones/{milestone_id}")
    def navigate(self, repo_owner, repo_identifier, milestone_id):
        """
        访问里程碑详情页
        """
        self.visit(f"/{repo_owner}/{repo_identifier}/milestones/{milestone_id}")

    @allure.step("点击【编辑里程碑】按钮")
    def click_edit_milestone_button(self):
        """
        点击【编辑里程碑】按钮
        """
        self.click(self.locator_edit_milestone_button)

    @allure.step("点击【+ 创建疑修】按钮")
    def click_new_issue_button(self):
        """
        点击【+ 创建疑修】按钮
        """
        self.click(self.locator_new_issue_btn)
